package io.choerodon.platform.api.controller.v1;

import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.ApiOperation;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.hzero.core.util.Results;
import org.hzero.mybatis.domian.MultiLanguage;
import org.hzero.platform.app.service.MultiLanguageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import io.choerodon.platform.api.controller.v1.vo.DateToken;
import io.choerodon.swagger.annotation.Permission;

/**
 * Created by wangxiang on 2022/7/21
 */
@RestController
@RequestMapping("/choerodon/v1/multi-language/tl")
public class MultiLanguageC7nController {
    @Autowired
    private MultiLanguageService multiLanguageService;

    @ApiOperation("多语言字段查询")
    @PostMapping
    @Permission(permissionLogin = true)
    public ResponseEntity<List<MultiLanguage>> listMultiLanguage(@RequestBody(required = true) DateToken token, @RequestParam String fieldName) throws JsonProcessingException, UnsupportedEncodingException {

        return Results.success(multiLanguageService.responseListMultiLanguage(token.get_token(), fieldName));
    }
}
